<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Testing</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysqlnd-ms.plugin-ini-v1.html">Plugin configuration file (&lt;= 1.0.x)</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlnd-ms.debugging.html">Debugging and Tracing</a></div>
 <div class="up"><a href="mysqlnd-ms.setup.html">安装／配置</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mysqlnd-ms.testing" class="section">
  <h2 class="title">Testing</h2>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    The section applies to mysqlnd_ms 1.1.0 or newer, not the 1.0 series.
   </p>
  </p></blockquote>
  <p class="para">
   The PECL/mysqlnd_ms test suite is in the <var class="filename">tests/</var>
   directory of the source distribution. The test suite consists of standard
   phpt tests, which are described on the PHP Quality Assurance Teams website.
  </p>
  <p class="para">
   Running the tests requires setting up one to four MySQL servers. Some tests don&#039;t
   connect to MySQL at all. Others require one server for testing. Some require
   two distinct servers. In some cases two servers are used to emulate a
   replication setup. In other cases a master and a slave of an existing MySQL replication
   setup are required for testing. The tests will try to detect how many servers
   and what kind of servers are given. If the required servers are not found, the
   test will be skipped automatically.
  </p>
  <p class="para">
   Before running the tests, edit <var class="filename">tests/config.inc</var> to
   configure the MySQL servers to be used for testing.
  </p>
  <p class="para">
   The most basic configuration is as follows.
   <div class="example-contents">
<div class="cdata"><pre>
 putenv(&quot;MYSQL_TEST_HOST=localhost&quot;);
 putenv(&quot;MYSQL_TEST_PORT=3306&quot;);
 putenv(&quot;MYSQL_TEST_USER=root&quot;);
 putenv(&quot;MYSQL_TEST_PASSWD=&quot;);
 putenv(&quot;MYSQL_TEST_DB=test&quot;);
 putenv(&quot;MYSQL_TEST_ENGINE=MyISAM&quot;);
 putenv(&quot;MYSQL_TEST_SOCKET=&quot;);

 putenv(&quot;MYSQL_TEST_SKIP_CONNECT_FAILURE=1&quot;);
 putenv(&quot;MYSQL_TEST_CONNECT_FLAGS=0&quot;);
 putenv(&quot;MYSQL_TEST_EXPERIMENTAL=0&quot;);

 /* replication cluster emulation */
 putenv(&quot;MYSQL_TEST_EMULATED_MASTER_HOST=&quot;. getenv(&quot;MYSQL_TEST_HOST&quot;));
 putenv(&quot;MYSQL_TEST_EMULATED_SLAVE_HOST=&quot;. getenv(&quot;MYSQL_TEST_HOST&quot;));

 /* real replication cluster */
 putenv(&quot;MYSQL_TEST_MASTER_HOST=&quot;. getenv(&quot;MYSQL_TEST_EMULATED_MASTER_HOST&quot;));
 putenv(&quot;MYSQL_TEST_SLAVE_HOST=&quot;. getenv(&quot;MYSQL_TEST_EMULATED_SLAVE_HOST&quot;));
</pre></div>
     </div>

   </p>
   <p class="para">
    <em>MYSQL_TEST_HOST</em>, <em>MYSQL_TEST_PORT</em> and
    <em>MYSQL_TEST_SOCKET</em> define the hostname,
    TCP/IP port and Unix domain socket of the default database server.
    <em>MYSQL_TEST_USER</em> and <em>MYSQL_TEST_PASSWD</em>
    contain the user and password needed to connect to the database/schema
    configured with <em>MYSQL_TEST_DB</em>. All configured
    servers must  have the same database user configured to give access to
    the test database.
   </p>
   <p class="para">
    Using <em>host</em>, <em>host:port</em> or <em>host:/path/to/socket</em>
    syntax one can set an alternate  host, host and port or host and socket for any
    of the servers.
   <div class="example-contents">
<div class="cdata"><pre>
putenv(&quot;MYSQL_TEST_SLAVE_HOST=192.168.78.136:3307&quot;));
putenv(&quot;MYSQL_TEST_MASTER_HOST=myserver_hostname:/path/to/socket&quot;));
</pre></div>
     </div>

   </p>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysqlnd-ms.plugin-ini-v1.html">Plugin configuration file (&lt;= 1.0.x)</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlnd-ms.debugging.html">Debugging and Tracing</a></div>
 <div class="up"><a href="mysqlnd-ms.setup.html">安装／配置</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
